home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Read It Later 0.9924 / read_it_later-0.9924-fx.xpi / chrome / isreaditlater.jar / content / ISRILprefs.js < prev    next >
Text File  |  2008-11-02  |  5KB  |  143 lines

  1. function ISRILprefs()
  2. {
  3.     this.sPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("isreaditlater.");
  4. }
  5.  
  6. ISRILprefs.prototype = {
  7.     
  8.     setPrefIfNot : function(p, v) {
  9.         if(!ISRILprefs.prefIsSet(p)) {
  10.             ISRILprefs.setPref(p, v);
  11.         }
  12.     },
  13.     
  14.     prefIsSet : function(p) { 
  15.         return ( (ISRILprefs.sPrefs.prefHasUserValue(p)) ? (true) : (false) );
  16.     },
  17.     
  18.     setPref : function(p, v) {
  19.         return ISRILprefs.sPrefs.setCharPref(p, v);
  20.     },
  21.     
  22.     renamePref : function(op, np) {
  23.         ISRILprefs.setPref(np, ISRILprefs.pref(op));
  24.         ISRILprefs.delPref(op);
  25.     },
  26.     
  27.     delPref : function(p) {
  28.         if (ISRILprefs.prefIsSet(p)) {
  29.             return ISRILprefs.sPrefs.clearUserPref(p);
  30.         }
  31.     },
  32.     
  33.     append : function(p, v) {
  34.         return ISRILprefs.sPrefs.setCharPref(p, ISRILprefs.pref(p) + v);    
  35.     },
  36.     
  37.     pref : function(p) {
  38.         return ISRILprefs.sPrefs.getCharPref(p);
  39.     },
  40.     
  41.     prefB : function(p) {
  42.         return ( (ISRILprefs.pref(p)=='true') ? (true):(false) );
  43.     },
  44.     
  45.     loadDefaults : function() {        
  46.         
  47.         //Installation        
  48.         ISRILprefs.setPrefIfNot("installed",        (ISRILprefs.prefIsSet('version')) ? true : false );
  49.         ISRILprefs.setPrefIfNot("sites",         ',6,7,47,19,26,44');
  50.         ISRILprefs.setPrefIfNot("version",         ((ISRIL.v > '0.97')?(ISRIL.v):('')) ); //added in 0.98, this shows changelog to those upgrading from version previous to this
  51.         ISRILprefs.setPrefIfNot("added_to_toolbar",    false);
  52.         ISRILprefs.setPrefIfNot("install-version",    '0');
  53.         
  54.         //Reading/Saving
  55.         ISRILprefs.setPrefIfNot("read",         'next');
  56.         ISRILprefs.setPrefIfNot("mark",         'null');
  57.         ISRILprefs.setPrefIfNot("open",         'current');        
  58.         ISRILprefs.setPrefIfNot("auto-tags",        '');
  59.         ISRILprefs.setPrefIfNot("autoMark",        0);
  60.         ISRILprefs.setPrefIfNot("autoOffline",        false);
  61.         ISRILprefs.setPrefIfNot("auto-close-tab",    false);    
  62.         
  63.         //Appearance
  64.         ISRILprefs.setPrefIfNot("context-menu",    true);        
  65.         ISRILprefs.setPrefIfNot("list-view",        'normal');
  66.         ISRILprefs.setPrefIfNot("list-place",        'btn');
  67.         ISRILprefs.setPrefIfNot("list-type",        'pages');        
  68.         ISRILprefs.setPrefIfNot("list-page",        9);
  69.         ISRILprefs.setPrefIfNot("default-sort",     '11');    
  70.         ISRILprefs.setPrefIfNot("ask-aiderss",        true);
  71.         ISRILprefs.setPrefIfNot("clicktosaveinbar",    true);    
  72.         ISRILprefs.setPrefIfNot("show-count",        false);
  73.         ISRILprefs.setPrefIfNot("link-checks",        'hide');
  74.         ISRILprefs.setPrefIfNot("force-styles",    true);
  75.         
  76.         //Keystrokes
  77.         ISRILprefs.setPrefIfNot("hotkey_toggle",    'alt||W');
  78.         ISRILprefs.setPrefIfNot("hotkey_push",        'alt||P');
  79.         ISRILprefs.setPrefIfNot("hotkey_open_list",    'alt||Q');    
  80.         ISRILprefs.setPrefIfNot("hotkey_click_mode",    'alt||M');
  81.         
  82.         //Syncing
  83.         ISRILprefs.setPrefIfNot("feed",         false);
  84.         ISRILprefs.setPrefIfNot("feed-id-default",    '0');
  85.         ISRILprefs.setPrefIfNot("feed-id-alt",     '0');
  86.         ISRILprefs.setPrefIfNot("feed-which",         'default');
  87.         ISRILprefs.setPrefIfNot("sync",         false);
  88.         ISRILprefs.setPrefIfNot("sync-default",    '0');
  89.         ISRILprefs.setPrefIfNot("sync-alt",         '0');
  90.         ISRILprefs.setPrefIfNot("feed-private",    false);
  91.         ISRILprefs.setPrefIfNot("super-security-mode",    false);
  92.         ISRILprefs.setPrefIfNot("feed-email-saved",    false);
  93.         ISRILprefs.setPrefIfNot("last_get",        '0');
  94.         ISRILprefs.setPrefIfNot("shutdown-send",    true);        
  95.         ISRILprefs.setPrefIfNot("shutdown-prompt",    true);        
  96.         ISRILprefs.setPrefIfNot("online-access-prompt",true);
  97.         
  98.         //Google Reader    
  99.         ISRILprefs.setPrefIfNot("integrate-gr",    true);
  100.         
  101.         
  102.         //Prompt Windows        
  103.         ISRILprefs.setPrefIfNot("prompt_clear_offline",true);        
  104.         
  105.         //Debug
  106.         ISRILprefs.setPrefIfNot("debug",        false);
  107.         
  108.         
  109.         
  110.         // -- Upgrading prefs from old versions -- //
  111.         
  112.         try {
  113.             //keystroke format update - 0.98
  114.             if (ISRILprefs.pref('hotkey_toggle').length <= 1) {
  115.                 ISRILprefs.setPref('install-version',        '0.97');
  116.                 
  117.                 ISRILprefs.setPref('hotkey_toggle',         'alt||'+ISRILprefs.pref('hotkey_toggle'));    
  118.                 ISRILprefs.setPref('hotkey_push',         'alt||'+ISRILprefs.pref('hotkey_push'));    
  119.                 ISRILprefs.setPref('hotkey_open_list',     'alt||'+ISRILprefs.pref('hotkey_open_list'));    
  120.                 ISRILprefs.setPref('hotkey_click_mode',     'alt||'+ISRILprefs.pref('hotkey_click_mode'));                    
  121.             }
  122.             
  123.             //changes - 0.99
  124.             if (ISRILprefs.sPrefs.prefHasUserValue('last_usync')) {
  125.                 ISRILprefs.setPref('install-version',        '0.98');
  126.                 
  127.                 ISRILprefs.renamePref('last_usync',         'last_get');        
  128.                 ISRILprefs.delPref("temp-sync-inserts");
  129.                 ISRILprefs.delPref("temp-sync-updates");
  130.                 ISRILprefs.delPref("temp-sync-tagUpdates");                
  131.                 
  132.                 ISRILglobals.flagRenameFiles = true; //rename offline files from GUID to id when offline starts up
  133.             }
  134.         } catch(e) {
  135.             //nothing critical here, just cleaning up, so fail silently if there is a problem
  136.         }
  137.         
  138.         
  139.     },
  140.     
  141. }
  142.  
  143. var ISRILprefs = new ISRILprefs();